/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package hoja.de.trabajo.pkg6;

/**
 *
 * @author CarlosAndre
 */

public class Decodificar {
    private String codigos[] = new String[20];
    private String[] lista;
    private String mensaje[] = new String[20];
    private int con=0;
    public Decodificar(){
        
    }
    public void decodifica(String binario){
        lista=binario.split("");
        for (int i=0;i<binario.length(); i++){
            if (i<binario.length()){
                if (lista[i].equals("0")){
                    System.out.print("a");
                }
                else if ((lista[i].equals("1"))&&lista[i+1].equals("1")&&lista[i+2].equals("1")){
                    System.out.print("b");
                    i=i+2;
                }
                else if ((lista[i].equals("1"))&&lista[i+1].equals("0")&&lista[i+2].equals("0")){
                    System.out.print("c");
                    i=i+2;
                }
                else if ((lista[i].equals("1"))&&lista[i+1].equals("0")&&lista[i+2].equals("1")){
                    System.out.print("d");
                    i=i+2;
                }
            }
            
        }
        
    }
}
